package com.homelock.constants;

public enum OpmodeEnum {
  UNLOCK_FINGER((byte)1, "指纹解锁"),
  UNLOCK_PASSWPRD((byte)2, "密码解锁"),
  UNLOCK_CARD((byte)3, "IC卡解锁"),
  UNLOCK_TPWD((byte)4, "临时密码解锁"),
  ;
  private byte opmode;
  private String desc;
  private OpmodeEnum(byte opmode, String desc) {
    this.opmode = opmode;
    this.desc = desc;
  }
  public byte getOpmode() {
    return opmode;
  }
  public String getDesc() {
    return desc;
  }
  public static OpmodeEnum getOpmodeEnum(Integer opmode) {
    if(null == opmode) {
      return null;
    }
    for(OpmodeEnum opmodeEnum: values()) {
      if(opmodeEnum.getOpmode() == opmode.byteValue()) {
        return opmodeEnum;
      }
    }
    return null;
  }
}
